<!DOCTYPE html>
<html>
<% include ./user_component/head.ejs%>
<style>
    .userImage {
        margin: 0 0 30px 110px;
    }

</style>

<body>
    <div class="x-body">
        <img class="userImage">
        <form class="layui-form">
            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    姓名
                </label>
                <div class="layui-input-inline">
                    <input type="text"  id="username" name="userName"
                        class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    将会成为老师的姓名
                </div>
            </div>
            <div class="layui-form-item">
              <label for="kemu" class="layui-form-label">
                  科目
              </label>
              <div class="layui-input-inline">
                  <input type="text"  id="kemu" name="kemu"
                      class="layui-input">
              </div>
              <div class="layui-form-mid layui-word-aux">
                  将会成为老师的科目
              </div>
          </div>

            <div class="layui-form-item">
                <label for="L_repass" class="layui-form-label">
                </label>
                <button class="layui-btn" lay-filter="add" lay-submit="">
                    增加
                </button>
            </div>
        </form>
    </div>
    <script>
        layui.use(['form', 'layer'], function () {
            $ = layui.jquery;
            var form = layui.form
                , layer = layui.layer;
            //监听提交
            form.on('submit(add)', function (data) {
              console.log(data.field)
              $.ajax({url:'/api/addTeacher',data:data.field,method:'POST',success:(res)=>{
                console.log(res)
              }})
            });
        });
    </script>
</body>

</html>
